﻿@model Mobile.Models.Queue

@{
    var NowPlaying = Model.getNowPlaying();
    var LastPlaying = Session["LastPlaying"] as Mobile.Models.Song;
    var LastUpdate = Session["LastUpdate"] as DateTime? ?? DateTime.MinValue;
    
    var vote_max = 10;
    var vote_replen = 4;
    
    if(DateTime.Now - LastUpdate > TimeSpan.FromMinutes(5) || LastPlaying == null || LastPlaying.ID != NowPlaying.ID)
    {
        Session["Votes"] = Math.Min(vote_max, ((int?)Session["Votes"] ?? vote_max) + vote_replen);
    }

    Session["LastUpdate"] = DateTime.Now;
    Session["LastPlaying"] = NowPlaying;
}

<div class="nowPlaying">
  <h1>Now Playing</h1>
                    <h2>@NowPlaying.Title</h2>
                    <h3>@NowPlaying.Artist</h3>
</div>